package com.android.openapp.map;

import android.content.res.Resources;
import android.graphics.drawable.Drawable;

import com.android.openapp.data.Place;
import com.android.openapp.ui.MainActivity;
import com.google.android.maps.GeoPoint;
import com.google.android.maps.OverlayItem;

public class LombardiaOverlayItem extends OverlayItem {

	private int listIndex;
	public static Resources mResources;
	
	public LombardiaOverlayItem(GeoPoint arg0, String arg1, String arg2) {
		super(arg0, arg1, arg2);
		// TODO Auto-generated constructor stub
	}
	
	public LombardiaOverlayItem(GeoPoint arg0, String arg1, String arg2, int index) {
		super(arg0, arg1, arg2);
		listIndex = index;
		Drawable marker = mResources.getDrawable(Place.lista.get(index).getPhotoRes());
		
		//Set the bounding for the drawable
//		marker.setBounds(
//		    0 - marker.getIntrinsicWidth() / 2, 0 - marker.getIntrinsicHeight(), 
//		    marker.getIntrinsicWidth() / 2, 0);

		float dip = 36f;
		int side = (int)(dip * MainActivity.screenDensity);
		marker.setBounds(0, 0, side, side);
		setMarker(marker);
	}
	
	public int getListIndex(){
		return listIndex;
	}

}
